﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace quanlycuahangtruyen
{
    public partial class phanmemquanly : Form
    {
        private bool _trangthai = false;


        public phanmemquanly()
        {
            InitializeComponent();
        }
         public phanmemquanly(bool trangthai)
        {
            InitializeComponent();
            _trangthai = trangthai;
            if (_trangthai == true)
            {
                menuStrip.Visible = true;
            }
            else
            {
                menuStrip.Visible = false;
            }
            
        }





        

        public bool CheckExistForm(string formName)
        {
            foreach (Form cForm in this.MdiChildren)
            {
                if (cForm.Name == formName)
                {
                    cForm.Activate();
                    return true;
                }
            }
            return false;
        }
        private void quảnLýSáchToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (CheckExistForm("quanlysach"))
            {
                return;
            }
            quanlysach childForm = new quanlysach();
            childForm.MdiParent = this;
            childForm.Show();
        }

        private void quảnLýKháchHàngToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (CheckExistForm("quanlykhachhang"))
            {
                return;
            }
            quanlykhachhang childForm = new quanlykhachhang();
            childForm.MdiParent = this;
            childForm.Show();
        }

        private void thểLoạiToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (CheckExistForm("theloai"))
            {
                return;
            }
            theloai childForm = new theloai();
            childForm.MdiParent = this;
            childForm.Show();
        }

        private void đăngNhậpToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (CheckExistForm("dangnhap"))
            {
                return;
            }
            danhnhap childForm = new danhnhap();
            childForm.MdiParent = this;
            childForm.Show();
        }

        private void nHàXuấtBảnToolStripMenuItem_Click(object sender, EventArgs e)
        {

            if (CheckExistForm("dangnhap"))
            {
                return;
            }
            Nhaxuatban childForm = new Nhaxuatban();
            childForm.MdiParent = this;
            childForm.Show();
        }

    }
}
